package pl.ptemich.eav.engine.physics.impl;

import org.newdawn.slick.SlickException;

import pl.ptemich.eav.engine.Point;
import pl.ptemich.eav.engine.physics.DynamicParameters;
import pl.ptemich.eav.engine.physics.InteractiveObject;
import pl.ptemich.eav.engine.physics.ShapeParameters;

public class InteractiveObjectImpl extends DynamicObjectImpl implements InteractiveObject {
  
  public InteractiveObjectImpl(Point worldPosition, float marginX, float marginY, ShapeParameters shapeParematers, DynamicParameters dynamicParams) throws SlickException {
    super(worldPosition, marginX, marginY, shapeParematers, dynamicParams);
  }
  
  @Override
  public void moveRight() {
    setHorizontalSpeed(getDynamicParams().getStepSpeed());
  }
 
  @Override
  public void moveLeft() {
    setHorizontalSpeed(-getDynamicParams().getStepSpeed());
  }

  @Override
  public void jump() {
    triggerJump(getDynamicParams().getMaxJumpHeight());
  }  
  
  @Override
  public void doubleJump() {
    triggerJump(2 * getDynamicParams().getMaxJumpHeight());
  }
  
  @Override
  public void stop() {
    setHorizontalSpeed(0);
  }
  
  @Override
  public void transferTo(float posX, float posY) {
    setWorldPosition(new Point(posX, posY));
  }

}
